package com.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class HelloController {
    @RequestMapping("/hello")
    public String Hello(){
        /*逻辑视图*/
        return "success";
    }


    @RequestMapping("/str")
    @ResponseBody
    public String STR(){
        return "success";
    }

    @RequestMapping("/json")
    @ResponseBody
    public List<Object> JSON(){
        List <Object> list = new ArrayList<>();
        list.add("张三");
        list.add("李四");
        return list;
    }


    @RequestMapping("/Exception")
    @ResponseBody
    public String json(){
        int i=10/0;
        return "404";
    }

}
